import request from '@/utils/request'

// 获取权限列表
export const getPermissionListAPI = () => {
  return request({
    url: '/sys/permission',
    method: 'get'
  })
}

// 编辑权限
export const editPermissionAPI = ({ id, name, code, description, type, pid, enVisible }) => {
  return request({
    url: '/sys/permission/' + id,
    method: 'put',
    data: {
      id,
      name,
      code,
      description,
      type,
      pid,
      enVisible
    }
  })
}

// 删除权限
export const delPermissionAPI = (id) => {
  return request({
    url: '/sys/permission/' + id,
    method: 'delete'
  })
}

// 新增权限
export const addPermissionAPI = ({ name, code, description, type, pid, enVisible }) => {
  return request({
    url: '/sys/permission',
    method: 'post',
    data: {
      name,
      code,
      description,
      type,
      pid,
      enVisible
    }
  })
}

// 权限详情
export const permissionDetails = (id) => {
  return request({
    url: '/sys/permission/' + id,
    method: 'get'
  })
}
